package com.tony.dao;

import com.tony.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class MoneyMapperImpl implements MoneyMapper {

    @Autowired
    private SqlSessionTemplate sessionTemplate;

    public void setSessionTemplate(SqlSessionTemplate sessionTemplate) {
        this.sessionTemplate = sessionTemplate;
    }


    @Override
    public void incrementMoney(Integer m, String username) {
        MoneyMapper mapper = sessionTemplate.getMapper(MoneyMapper.class);
        mapper.incrementMoney(m, username);
    }

    @Override
    public void decrementMoney(Integer m, String username) {
        MoneyMapper mapper = sessionTemplate.getMapper(MoneyMapper.class);
        mapper.decrementMoney(m, username);
    }
}
